package com.mystudy.springcloud.service;

import com.mystudy.springcloud.dao.StorageDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class StorageService {
	@Autowired
	private StorageDao storageDao;

	/**
	 * @功能: 减库存 已用库存 + count  | 剩余库存 - count
	 */
	public void decreaseStorage(Long productId, Integer count) {
		log.info("---------------------> 开始扣减库存 <---------------------");
		storageDao.decreaseStorage(productId, count);
		log.info("---------------------> 扣减库存完成 <---------------------");
	}
}
